<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <component :is="com"></component>
  </div>
  <script src="./vue.js"></script>
  <script>
    // 创建组件的class VueComponent
    Vue.component('CommonHead', {
      template: `
        <div>
          <h2>组件1</h2>  
        </div>
      `
    })
    Vue.component('CommonHead2', {
      template: `
        <div>
          <h2>组件2</h2>  
        </div>
      `
    })
    const vm = new Vue({
      el: '#app',
      data: {
        com: 'CommonHead2'
      }
    })
  </script>
</body>
</html>